package com.ta.gulimall.gulimall.elasticsearch.controller.web;

import com.ta.gulimall.gulimall.elasticsearch.service.SearchTaService;
import com.ta.gulimall.gulimall.elasticsearch.vo.SearchDto;
import com.ta.gulimall.gulimall.elasticsearch.vo.SearchVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

@Controller
@Slf4j
public class SearchController {
    @Autowired
    SearchTaService searchService;

    @GetMapping("/list.html")
    public String search(SearchDto searchDto, Model model) {

        SearchVo response = searchService.search(searchDto);
        model.addAttribute("result", response);

        return "list";
    }

}
